/**
 * Created by dev-001 on 2017/3/24.
 */
import mongoose from 'mongoose';
const Schema = mongoose.Schema;
const ObjectId = Schema.Types.ObjectId;

const ExamGroupSchema = new Schema({
    name: String,
    teacher: {
        type: ObjectId,
        ref: 'User'
    }, //题组创建者
    school: {
        type: ObjectId,
        ref: 'School'
    },
    startedAt: Date, // 第一科考试时间
    endedAt: Date, // 最后一科考试时间
    status: String,
    createdAt: Date,
    updatedAt: Date
});

ExamGroupSchema.pre('save', function (next) {
    this.createdAt = new Date();
    next();
});

export default mongoose.model('ExamGroup', ExamGroupSchema);